package cn.yunyichina.scheduler.jobs.job.messages;

import cn.yunyichina.scheduler.jobs.service.message.MedicalReserveRegisterMessageService;
import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.type.simple.api.SimpleJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Created by Lullaby on 2016/8/10.
 */
@Component
public class MedicalReserveRegisterMessageJob implements SimpleJob {

    private static final Logger logger = LoggerFactory.getLogger(MedicalReserveRegisterMessageJob.class);

    private static final AtomicInteger count = new AtomicInteger(0);

    @Resource
    private MedicalReserveRegisterMessageService medicalReserveRegisterMessageService;

    public void execute(ShardingContext shardingContext) {
        int current = count.addAndGet(1);
        logger.info("第[{}]次医保预约挂号就诊当天消息推送任务开始执行", current);
        medicalReserveRegisterMessageService.pushMessageForMedicalReserveRegisterRecord();
        logger.info("第[{}]次医保预约挂号就诊当天消息推送任务执行结束", current);
    }

}
